<div class="posts index">
<h2><?php __('Posts');?></h2>
<!-- Table Navigation -->
<div class="tablenav">
    <div class="batchactions"></div>
    <?php echo $this->element('pager'); ?>
</div>
<!-- Table Content Area -->
<table id="table_posts" class="table fixed">
    <thead title="<?php __('Click a column to sort data table'); ?>">
        <tr>
            <th  width="3%" class="checkbox" title="<?php __('Click to select/deselect all records'); ?>"><input type="checkbox" class="checkbox"/></th>
            <th width="7%"><?php e($paginator->sort('id'));?></th>
            <th width="40%"><?php e($paginator->sort('title'));?></th>
            <th width="12%"><?php e($paginator->sort('created'));?></th>
            <th width="10%"><?php e($paginator->sort('user_id'));?></th>
            <th width="10%"><?php e($paginator->sort('post_term_id'));?></th>
            <th width="20%" class="actions"><?php __('Actions');?></th>
        </tr>
    </thead>
    <tfoot title="<?php __('Click a column to sort data table'); ?>">
        <tr>
            <th class="checkbox" title="<?php __('Click to select/deselect all records'); ?>"><input type="checkbox" class="checkbox"/></th>
            <th><?php e($paginator->sort('id'));?></th>
            <th><?php e($paginator->sort('title'));?></th>
            <th><?php e($paginator->sort('created'));?></th>
            <th><?php e($paginator->sort('user_id'));?></th>
            <th><?php e($paginator->sort('post_term_id'));?></th>
            <th class="actions"><?php __('Actions');?></th>
        </tr>
    </tfoot>
    <tbody>
        <?php //debug($posts); ?>
        <?php foreach ($posts as $i=>$post):
            $class = $i++ % 2 == 0 ? ' class="altrow"' : ''; ?>
        <tr<?php e($class);?>>
            <td class="checkbox"><input type="checkbox" class="checkbox"/></td>
            <td><?php e($post['Post']['id']); ?></td>
            <td><?php e($post['Post']['title']); ?></td>
            <td><?php e(date('Y-m-d', strtotime($post['Post']['created']))); ?></td>
            <td><?php e($post['User']['username']); ?></td>
            <td><?php e($post['PostTerm']['name']); ?></td>
            <td class="actions">
                <?php e($html->link(__('View', true), array('action' => 'view', $post['Post']['id']))); ?>
                <?php if($user['group'] != 'student'): ?>
                    <?php e($html->link(__('Edit', true), array('action' => 'edit', $post['Post']['id']))); ?>
                    <?php e($html->link(__('Delete', true), array('action' => 'delete', $post['Post']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $post['Post']['id']))); ?>
                    <!-- Script for ajax Company deletion -->
                    <script type="text/javascript">
                        jQuery(function(){
                            $('table#table_posts td.actions a[href*=delete]').click($.sme.cbk.ajaxDelete);
                        });
                    </script>
                <?php endif; ?>
            </td>
        </tr>
        <?php endforeach; ?>
    <tbody>
</table>
</div>
<?php if($user['group'] != 'student'): ?>
<div class="actions">
    <ul><li><?php e($html->link(__('New Post', true), array('action' => 'add'))); ?></li></ul>
</div>
<?php endif; ?>